Repository navigation
feat(runs): persisted run history (T-K1) - #442
Merged
Merged
Conversation
One RunRecord per generation, workflow or mesh-op run, kept in a JSON file at the workspace root. Writes are atomic, a corrupt file is moved aside, runs a previous backend left in flight are marked interrupted on load, and the history is capped. The record shape is the one provenance (T-F1) will reuse.
…ow-runs
Generation jobs are recorded when filed, started and ended (cancel included),
with their step timings. Mesh ops that write a mesh or fail are recorded too.
GET /workflow-runs pages the history with status/kind filters, PUT
/workflow-runs/{id} lets the renderer report workflow runs, and
GET /workflow-runs/{id} falls back to the history once a job is purged.
The workflow runner reports its run record (per-node step timings, final
status, output) to PUT /workflow-runs/{id}, chaining writes so the final
status always lands last. Cancelled and abandoned runs are recorded as
cancelled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Runs now leave a persisted record that survives a restart: generations, workflows and mesh ops, including failed, cancelled and interrupted ones (T-K1).
Refs #411
Record shape
api/schemas/runs.py(RunRecord) and mirrored insrc/shared/types/runs.ts. Fields:id,kind(generation|workflow|mesh_op);status(pending|running|done|error|cancelled|interrupted);inputs,params, timedsteps[],error,output_path;created_at,started_at,ended_at, and a computedduration_s.Storage (
api/services/run_history.py).modly-run-history.json. It is hidden from collections and the asset library, and it follows the workspace if it moves.os.replace)..corrupt-<ts>.interrupted.What gets recorded
/generate/from-image,/generate/from-artifactand/workflow-runs/from-image, recorded as they are queued, start and end. Cancels are recorded immediately. Progress labels become timed steps./optimize/op/{id},/optimize/meshand/optimize/smooth. Report-only ops (inspect_mesh,suggest_fixes) are skipped.PUT /workflow-runs/{id}, with one timed step per node. Writes are serialized so the final status always wins.Endpoints (existing
/workflow-runsrouter)GET /workflow-runs?status=&kind=&limit=&offset=: newest first, repeatable filters,limitat most 200.PUT /workflow-runs/{id}: creates or replaces a workflow record. Returns 409 if the id belongs to a backend-owned run.GET /workflow-runs/{id}: falls back to the history once the live job has been purged or the app restarted.Known limits
generationrecords, not linked to the parent workflow record./transform,/arrangeand/patch-verticesare not recorded.interruptedruns have noended_ator duration, since the real stop time is unknown.Test plan
python -m unittest discover -s tests: 27 new tests (store lifecycle, paging, filters, retention, restart and shutdown interruption, corrupt/missing file, atomic writes, endpoints, generation done/error/cancel, mesh-op recording)npm run test:node: 8 new tests for the workflow record helpersnpm run lintGET /workflow-runsfor each status and duration;interruptedafter a restart.